<template>
	<view>
		<view class="video-list">
			<view class="video-content" v-for="(item, ind) in times" :key="ind">
				<!-- <view class="video-cover">
					<image :src="item.picUrl" mode="aspectFill"></image>
				</view> -->
				<view class="video-describe">
					<view style="width: 80%;">
						<view class="video-tit">
							时长:{{item.name}}
						</view>
					</view>
					<view>
						<view @click="openByTime(item)" class="iconfont icon-set" style="color: #161616;font-size: 32rpx;margin-top: 15rpx;">
							<text style="margin-left: 10rpx;font-size: 26rpx;color: #4a4a4a;">开启</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Api from '@/common/api';
	import '@/static/icon/iconfont.css';
	export default {
		components: {
		},
		data() {
			return {
				index: 0,
				deviceId:null,
				deviceType:null,
				times:[
					{
						name: '1小时',
						val: 1
					},
					{
						name: '2小时',
						val: 2
					},
					{
						name: '3小时',
						val: 3
					},
					{
						name: '4小时',
						val: 4
					},
					{
						name: '5小时',
						val: 5
					},
					{
						name: '6小时',
						val: 6
					}
				]
			}
		},
		onShow() {
		},
		onLoad(options) {
			this.deviceId = options.deviceId;
			this.deviceType = options.deviceType;
		},
		methods: {
			async openByTime(item) {
				let that = this;
				let data = await Api.apiCall('get', Api.qsg.openByTime, {
					deviceId: that.deviceId,
					duration: item.val
				});
				if (data) {
					uni.showToast({
						icon: 'success',
						title: '操作成功'
					})
				}
			},
		}
	}
</script>

<style>
	.afrim{
		width: 650rpx;
		height: 80rpx;
		background: #0DA944;
		border-radius: 30rpx;
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 80rpx;
		text-align: center;
		position: fixed;
		bottom: calc(100% - 95%);
		margin-left: 40rpx;
	}
	.priceSign{
		font-size: 24rpx;
	}
	.priceNum{
		font-size: 32rpx;
		font-weight: bold;
	}
	.priceIcon{
		font-size: 24rpx;
	}
	.schoolName{
		width: 750rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		font-size: 50rpx;
		font-weight: bold;
		color: #000000;
	}
	.uni-input{
		padding: 0 24rpx;
	}
	.choese{
		width: 750rpx;
		display: flex;
		box-sizing: border-box;
		padding:0 30rpx;
		color: #888888;
	}
	.dataName{
		height: 60rpx;
	}
	.currentSchool{
		height: 60rpx;
		background: #FFFFFF;
	}
	.video-tit {
		font-size: 30rpx;
		color: #62b074;
		font-weight: bold;
		display: inline-block;
		vertical-align: top;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	
	.checkMore text{
		display: block;
		width: 100%;
		height: 60rpx;
		line-height: 58rpx;
		font-size: 24rpx;
		color: #172a89;
		border: 1px solid #172A89;
		text-align: center;
		box-sizing: border-box;
		margin-top: 46rpx;
		border-radius: 50rpx;
	}
	
	.checkMore {
		font-size: 24rpx;
		color: #172a89;
		flex: 1;
	}
	
	.buttomopendoor1 {
		width: 400rpx;
		height: 80rpx;
		background: #E3F6E4;
		border: 1px solid #B8E6BA;
		border-radius: 40rpx;
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #0DA944;
		line-height: 80rpx;
		text-align: center;
		margin-top: 60rpx;
	}
	
	.buttomopendoor2 {
		width: 400rpx;
		height: 80rpx;
		background: #0DA944;
		border-radius: 40rpx;
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 80rpx;
		text-align: center;
		margin-top: 24rpx;
	}
	
	.unipopup {
		height: 300rpx;
		width: 480rpx;
		background-color: #FFFFFF;
		display: flex;
		flex-direction: column;
		align-items: center;
		border-radius: 24rpx;
	}
	
	.video-price {
		font-size: 30rpx;
		color: #666;
		overflow: hidden;
		display: inline-block;
		vertical-align: top;
		text-align: center;
		box-sizing: border-box;
	}
	
	.video-reader {
		font-size: 24rpx;
		color: #666;
	}
	
	.video-describe {
		display: inline-block;
		vertical-align: top;
		display: flex;
		width: 100%;
		padding-left: 20rpx;
	}
	
	.video-cover {
		width: 100rpx;
		height: 100rpx;
		margin: 30rpx 30rpx 30rpx 0;
		display: inline-block;
		vertical-align: top;
		border-radius: 50%;
		flex: 1;
	}
	
	.video-cover image {
		width: 100rpx;
		height: 100rpx;
		background: #FFFFFF;
		border-radius: 50%;
	}
	
	.video-content {
		width: 690rpx;
		padding: 22rpx 0;
		border: 1rpx solid #f1f1f1;
		box-shadow: 0 0 10px #e6e6e6;
		border-radius: 20rpx;
		box-sizing: border-box;
		display: flex;
		margin-top: 20rpx;
	}
	
	.video-content:last-child {
		border: none;
	}
	
	.video-list {
		width: 750rpx;
		height: auto;
		padding: 0 30rpx;
		box-sizing: border-box;
	}
</style>
